<template>
  <!-- 基本信息 -->
  <div>
    <el-form
      label-width="auto"
      :model="ruleForm"
      :rules="rules"
      ref="ruleForm"
      class="demo-ruleForm"
    >
      <el-row type="flex" justify="center" :gutter="0">
        <el-col :span="12">
          <el-form-item label="填报单位：" prop="reportInOrgName">
            <el-select
              :disabled="$route.query.submit === '已提交'"
              v-if="$route.query.status !== '查看'"
              v-model="ruleForm.reportInOrgName"
              placeholder="请选择填报单位"
              @change="changeReportInOrgId"
            >
              <el-option
                v-for="item in reportOptions"
                :key="item.orgId"
                :label="item.name"
                :value="item.name"
              >
              </el-option>
            </el-select>
            <span v-else>{{ ruleForm.supplier }}</span>
          </el-form-item>
        </el-col>
        <el-col :span="12" :offset="4">
          <el-form-item label="供应商：" prop="supplier">
            <el-input
              disabled
              v-model="ruleForm.supplier"
              v-if="$route.query.status !== '查看'"
            ></el-input>
            <span v-else>{{ ruleForm.supplier }}</span>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex" justify="center" :gutter="0">
        <el-col :span="12">
          <el-form-item label="验收单编号：">
            <el-input
              disabled
              v-model="ruleForm.acceptanceNumber"
              v-if="$route.query.status !== '查看'"
            ></el-input>
            <span v-else>{{ ruleForm.acceptanceNumber }}</span>
          </el-form-item>
        </el-col>
        <el-col :span="12" :offset="4">
          <el-form-item label="验收单名称：" prop="acceptanceName">
            <el-input
              :disabled="$route.query.status === '查看'"
              v-model="ruleForm.acceptanceName"
              maxlength="300"
              show-word-limit
              v-if="$route.query.status !== '查看'"
              @blur="handleTrim('acceptanceName')"
            ></el-input>
            <span v-else>{{ ruleForm.acceptanceName }}</span>
          </el-form-item>
        </el-col>
      </el-row>

      <!-- 按订单验收 -->
      <template v-if="ruleForm.acceptanceTypeCode == '2'">
        <el-row type="flex" justify="center" :gutter="0">
          <el-col :span="12" class="relative">
            <el-form-item label="订单编号：" prop="orderNumber">
              <el-input
                disabled
                type="text"
                v-model="ruleForm.orderNumber"
                v-if="$route.query.status !== '查看'"
              ></el-input>
              <span v-else>{{ ruleForm.orderNumber }}</span>
              <el-button
                v-if="$route.query.status === '新增'"
                class="chereay"
                type="single-number"
                @click="ordervisabled = true"
                >选择</el-button
              >
            </el-form-item>
          </el-col>
          <el-col :span="12" :offset="4">
            <el-form-item label="订单名称：" prop="orderName">
              <el-input
                disabled
                type="text"
                v-model="ruleForm.orderName"
                v-if="$route.query.status !== '查看'"
              ></el-input>
              <span v-else>{{ ruleForm.orderName }}</span>
            </el-form-item>
          </el-col>
        </el-row>
      </template>

      <!-- 按合同验收 -->
      <template v-else>
        <el-row type="flex" justify="center" :gutter="0">
          <el-col :span="12" class="relative">
            <el-form-item label="合同编号：" prop="contractNumber">
              <el-input
                disabled
                v-model="ruleForm.contractNumber"
                v-if="$route.query.status !== '查看'"
              ></el-input>
              <span v-else>{{ ruleForm.contractNumber }}</span>
              <el-button
                type="single-number"
                v-if="$route.query.status !== '查看'"
                class="chereay"
                @click="contractvsabled = true"
                :disabled="$route.query.submit === '已提交'"
                >选择
              </el-button>
            </el-form-item>
          </el-col>
          <el-col :span="12" :offset="4">
            <el-form-item label="合同名称：" prop="contractName">
              <el-input
                disabled
                v-model="ruleForm.contractName"
                v-if="$route.query.status !== '查看'"
              ></el-input>
              <span v-else :title="ruleForm.contractName" class="overflow">{{
                ruleForm.contractName
              }}</span>
            </el-form-item>
          </el-col>
        </el-row>
      </template>

      <el-row type="flex" justify="center" :gutter="0">
        <el-col :span="12">
          <el-form-item label="供应商联系电话：">
            <el-input
              disabled
              v-model="ruleForm.supplierPhone"
              v-if="$route.query.status !== '查看'"
            ></el-input>
            <span v-else>{{ ruleForm.supplierPhone }}</span>
          </el-form-item>
        </el-col>
        <el-col :span="12" :offset="4">
          <el-form-item label="车牌号：" prop="plateNumber">
            <el-input
              v-model="ruleForm.plateNumber"
              maxlength="10"
              show-word-limit
              v-if="$route.query.status !== '查看'"
              @blur="handleTrim('plateNumber')"
            ></el-input>
            <span v-else>{{ ruleForm.plateNumber }}</span>
          </el-form-item>
        </el-col>
      </el-row>

      <el-row type="flex" justify="center" :gutter="0">
        <el-col :span="12">
          <el-form-item label="司机姓名：" prop="driverName">
            <el-input
              :disabled="$route.query.status === '查看'"
              v-model="ruleForm.driverName"
              maxlength="50"
              show-word-limit
              v-if="$route.query.status !== '查看'"
              @blur="handleTrim('driverName')"
            ></el-input>
            <span v-else>{{ ruleForm.driverName }}</span>
          </el-form-item>
        </el-col>

        <el-col :span="12" :offset="4">
          <el-form-item label="司机手机号：" prop="driverPhone">
            <el-input
              v-model="ruleForm.driverPhone"
              maxlength="11"
              show-word-limit
              v-if="$route.query.status !== '查看'"
            ></el-input>
            <span v-else>{{ ruleForm.driverPhone }}</span>
          </el-form-item>
        </el-col>
      </el-row>

      <el-row type="flex" justify="center" :gutter="0">
        <el-col :span="12">
          <el-form-item label="验收人：" prop="acceptor">
            <el-input
              v-model="ruleForm.acceptor"
              maxlength="50"
              show-word-limit
              v-if="$route.query.status !== '查看'"
              @blur="handleTrim('acceptor')"
            ></el-input>
            <span v-else>{{ ruleForm.acceptor }}</span>
          </el-form-item>
        </el-col>
        <el-col :span="12" :offset="4">
          <el-form-item label="验收人联系电话：" prop="acceptancePhone">
            <el-input
              v-model="ruleForm.acceptancePhone"
              maxlength="11"
              show-word-limit
              v-if="$route.query.status !== '查看'"
            ></el-input>
            <span v-else>{{ ruleForm.acceptancePhone }}</span>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex" :gutter="0">
        <el-col :span="10">
          <el-form-item label="编制日期：" prop="compileDate">
            <el-date-picker
              disabled
              type="date"
              placeholder="选择日期"
              v-model="ruleForm.compileDate"
              style="width: 100%"
              v-if="$route.query.status !== '查看'"
            ></el-date-picker>
            <span v-else>{{ formatDate(ruleForm.compileDate) }}</span>
          </el-form-item>
        </el-col>
        <el-col :span="10" :offset="4">
          <el-form-item label="编制人：" prop="compilePeople">
            <el-input
              disabled
              v-model="ruleForm.compilePeople"
              v-if="$route.query.status !== '查看'"
            ></el-input>
            <span v-else>{{ ruleForm.compilePeople }}</span>
          </el-form-item>
        </el-col>
      </el-row>
      <el-form-item label="备注：" prop="remake">
        <el-input
          type="textarea"
          v-model="ruleForm.remake"
          maxlength="1000"
          show-word-limit
          v-if="$route.query.status !== '查看'"
          @blur="handleTrim('remake')"
        ></el-input>
        <span v-else>{{ ruleForm.remake }}</span>
      </el-form-item>
      <template v-if="ruleForm.acceptanceTypeCode == '3'">
        <el-form-item label="品牌星级：" prop="brandStar">
          <el-rate
            v-model="ruleForm.brandStar"
            style="margin-top: 6px"
            :disabled="$route.query.status == '查看'"
          ></el-rate>
        </el-form-item>
        <el-form-item label="品牌评价说明：" prop="brandState">
          <el-input
            maxlength="1000"
            show-word-limit
            type="textarea"
            v-model="ruleForm.brandState"
            v-if="$route.query.status !== '查看'"
            @blur="handleTrim('brandState')"
          ></el-input>
          <span v-else>{{ ruleForm.brandState }}</span>
        </el-form-item>
      </template>
      <el-form-item label="外观质量星级：" prop="appearanceStar">
        <el-rate
          :disabled="$route.query.status == '查看'"
          v-model="ruleForm.appearanceStar"
          style="margin-top: 6px"
        ></el-rate>
      </el-form-item>
      <el-form-item label="外观质量说明：" prop="appearanceState">
        <el-input
          v-if="$route.query.status !== '查看'"
          v-model="ruleForm.appearanceState"
          type="textarea"
          maxlength="1000"
          show-word-limit
          @blur="handleTrim('appearanceState')"
        ></el-input>
        <span v-else>{{ ruleForm.appearanceState }}</span>
      </el-form-item>
      <el-form-item label="数量星级：" prop="numberStar">
        <el-rate
          :disabled="$route.query.status == '查看'"
          v-model="ruleForm.numberStar"
          style="margin-top: 6px"
        ></el-rate>
      </el-form-item>
      <el-form-item label="数量评价说明：" prop="numberState">
        <el-input
          v-if="$route.query.status !== '查看'"
          maxlength="1000"
          show-word-limit
          type="textarea"
          v-model="ruleForm.numberState"
          @blur="handleTrim('numberState')"
        ></el-input>
        <span v-else>{{ ruleForm.numberState }}</span>
      </el-form-item>
      <el-form-item label="物流评价星级：" prop="logisticsEvaluationStar">
        <el-rate
          :disabled="$route.query.status == '查看'"
          v-model="ruleForm.logisticsEvaluationStar"
          style="margin-top: 6px"
        ></el-rate>
      </el-form-item>
      <el-form-item label="物流评价说明：" prop="logisticsEvaluationState">
        <el-input
          v-if="$route.query.status !== '查看'"
          maxlength="1000"
          show-word-limit
          type="textarea"
          v-model="ruleForm.logisticsEvaluationState"
          @blur="handleTrim('logisticsEvaluationState')"
        ></el-input>
        <span v-else>{{ ruleForm.logisticsEvaluationState }}</span>
      </el-form-item>
      <el-form-item
        label="物流现场配合度星级："
        prop="logisticsCoordinationStar"
      >
        <el-rate
          :disabled="$route.query.status == '查看'"
          v-model="ruleForm.logisticsCoordinationStar"
          style="margin-top: 6px"
        ></el-rate>
      </el-form-item>
      <el-form-item
        label="物流现场配合度说明："
        prop="logisticsCoordinationState"
      >
        <el-input
          v-if="$route.query.status !== '查看'"
          maxlength="1000"
          show-word-limit
          type="textarea"
          v-model="ruleForm.logisticsCoordinationState"
          @blur="handleTrim('logisticsCoordinationState')"
        ></el-input>
        <span v-else>{{ ruleForm.logisticsCoordinationState }}</span>
      </el-form-item>
    </el-form>
    <!-- 选择合同弹框列表 -->
    <!-- <check-contranct
      ref="checkContranct"
      :reportInOrgId="ruleForm.reportInOrgId"
      :isTrue="false"
      @inventoryConfirm="confirmTrue"
    ></check-contranct> -->
    <!-- 合同选择弹框 -->
    <contract-check
      v-if="contractvsabled"
      :contractvsabled.sync="contractvsabled"
    ></contract-check>
    <!-- 订单选择弹框 -->
    <order-check
      v-if="ordervisabled"
      :ordervisabled.sync="ordervisabled"
    ></order-check>
  </div>
</template>

<script>
// import checkContranct from "./check-contranct.vue";
import orderCheck from "./order-check.vue";
import contractCheck from "./contract-check.vue";
import { addUrlPerFix } from "@/basa/utils";
import { getUserInfo, getReportInOrgData } from "@/basa/api";
import { getSmpEquipmentConcById, getSmpPcConcById, getOrder } from "../api/index";
// import store from "@/config/store";
export default {
  props: {
    fromData: {
      type: Object,
      default: function() {
        return {};
      }
    }
  },
  watch: {
    fromData: {
      handler(n) {
        if (Object.values(n).length > 0) {
          this.ruleForm = n;
        }
      },
      immediate: true
    }
  },
  data() {
    const Mobile = (rule, value, callback) => {
      var myreg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
      if (value) {
        if (value.match(myreg)) {
          callback();
        } else {
          this.$showErrorMessage("请输入正确的手机号");
          callback(new Error(rule.message || "请输入正确的手机号"));
        }
      } else {
        callback();
      }
    };
    const tbdw = (rule, value, callback) => {
      if (value === "") {
        callback(new Error("填报单位不能为空"));
      } else {
        callback();
      }
    };
    return {
      ruleForm: {
        brandStar: 5,
        appearanceStar: 5,
        numberStar: 5,
        logisticsEvaluationStar: 5,
        logisticsCoordinationStar: 5
      },
      contractvsabled: false,
      ordervisabled: false,
      reportOptions: [], // 填报单位
      reportInOrgObj: {
        title: "填报单位查询",
        tableData: [],
        recordsTotal: 0,
        formDate: {
          mainType: "A",
          orgid: "",
          pageNo: 1,
          pageSize: 10
        }
      },
      rules: {
        // 验收人
        acceptor: [
          { required: true, message: "编制人不能为空", trigger: "change" }
        ],
        // 编制人
        compilePeople: [
          { required: true, message: "编制人不能为空", trigger: "change" }
        ],
        // 编制日期
        compileDate: [
          { required: true, message: "编制日期不能为空", trigger: "change" }
        ],
        // 供应商
        supplier: [
          { required: true, message: "填报单位不能为空", trigger: "change" }
        ],
        // 填报单位
        reportInOrgName: [
          {
            required: true,

            // trigger: "blur"
            trigger: "change",
            validator: tbdw
          }
        ],
        // 验收单编号表单验证
        acceptanceNumber: [
          { required: true, message: "验收单编号不能为空", trigger: "change" }
        ],
        // 验收单名称
        acceptanceName: [
          { required: true, message: "验收单名称不能为空", trigger: "change" }
        ],
        // 合同编号
        contractNumber: [
          { required: true, message: "合同编号不能为空", trigger: "change" }
        ],
        // 物流评价星级不能为空
        logisticsEvaluationStar: [
          { required: true, message: "物流评价星级不能为空", trigger: "change" }
        ],
        logisticsCoordinationStar: [
          {
            required: true,
            message: "物流现场配合度星级不能为空",
            trigger: "change"
          }
        ],
        // 司机手机号
        driverPhone: [
          {
            validator: Mobile,
            trigger: "change"
          }
        ],
        // 供应商联系电话
        supplierPhone: [
          {
            validator: Mobile,
            trigger: "change"
          }
        ],
        // 验收人联系电话
        acceptancePhone: [
          {
            required: true,
            message: "验收人联系电话不能为空",
            trigger: "change"
          },
          {
            required: true,
            validator: Mobile,
            trigger: "change"
          }
        ]
      }
    };
  },
  components: {
    orderCheck,
    contractCheck
  },
  activated() {
    this.getUserInfo();
    if (this.$route.query.status === "新增") {
      this.huixian();
    }
  },
  deactivated() {
    this.$refs["ruleForm"].resetFields();
  },
  methods: {
    // 获取用户信息(填报单位下拉组件)
    getUserInfo() {
      getUserInfo(
        addUrlPerFix(process.env.VUE_APP_BASEP_URL) + "/apis/basap/getUserInfo",
        {}
      ).then(res => {
        this.ruleForm.reportUsername = res.data.data.userInfo.name;
        this.ruleForm.reportOpenid = res.data.data.userInfo.id; //编制人id
        this.getReportInOrgData(res.data.data.userInfo.openId);
      });
    },
    // 填报信息(填报单位下拉组件)
    getReportInOrgData(openId) {
      getReportInOrgData({ openIds: [openId] }).then(res => {
        this.reportInOrgObj.tableData = res.data.data[openId];
        this.reportInOrgObj.recordsTotal = res.data.data[openId].length;
        this.reportOptions = res.data.data[openId];
        this.ruleForm.reportInOrgName =
          this.ruleForm.reportInOrgName || this.reportOptions[0].name;
        this.ruleForm.reportInOrgId =
          this.ruleForm.reportInOrgId || this.reportOptions[0].orgId;
      });
    },
    // 填报单位组件change
    changeReportInOrgId(val) {
      this.ruleForm = {};
      const tempObj = this.reportOptions.find(e => e.name === val);
      this.ruleForm.reportInOrgId = tempObj.orgId;
      this.ruleForm.reportInOrgName = tempObj.name;
      this.ruleForm.acceptanceNumber = this.fromData.acceptanceNumber;
      this.$forceUpdate();
      this.$emit("tbdwChange");
    },
    // 选择合同
    handleCheckContranct() {
      if (
        this.$refs["checkContranct"].reportInOrgId &&
        this.$refs["checkContranct"].reportInOrgId != ""
      ) {
        this.$refs["checkContranct"].dialogTableVisibletextarea = true;
        this.$refs["checkContranct"].getList();
      } else {
        this.$message({
          message: "请先选择填报单位",
          type: "error",
          duration: 2000,
          ccuiCustom: true
        });
      }
    },
    // 合同选择内验收按钮
    confirmTrue(val) {
      getSmpEquipmentConcById({
        concId: val.id
      }).then(res => {
        const { smpPcConc, pcFinance } = res.data.data;
        let obj = {};
        pcFinance.forEach(item => {
          if (item.suppType == 1) {
            obj = item;
          }
        });

        this.$set(
          this.ruleForm,
          "categoryName",
          smpPcConc.thirdCategoriesOfName
        );

        // 发货数量
        this.$set(
          this.ruleForm,
          "deliveryCurrentNumber",
          smpPcConc.shipmentsNum
        );
        // 订单编号
        this.$set(this.ruleForm, "orderNumber", smpPcConc.orderNumber);

        //   // 填报单位编码
        // this.$set(
        //   this.ruleForm,
        //   "reportInOrgId",
        //   JSON.parse(this.$route.query.orgRow).orgId
        // );
        // // 填报单位
        // this.$set(
        //   this.ruleForm,
        //   "reportInOrgName",
        //   JSON.parse(this.$route.query.orgRow).orgName
        // );
        // 供应商ID
        this.$set(this.ruleForm, "supplierOrgId", smpPcConc.companyOrgId); // 编码与id一样
        // 供应商编码
        this.$set(this.ruleForm, "supplierCode", smpPcConc.partyBId);
        // 供应商
        this.$set(this.ruleForm, "supplier", smpPcConc.partyBName);
        // 供应商联系电话
        this.$set(this.ruleForm, "supplierPhone", obj.contractPersonTel);
        // 合同名称
        this.$set(
          this.ruleForm,
          "contractName",
          smpPcConc.contractName.toString()
        );

        // 合同ID
        this.$set(this.ruleForm, "contractId", smpPcConc.id);

        // 合同编号
        this.$set(
          this.ruleForm,
          "contractNumber",
          smpPcConc.contractCode.toString()
        );

        // 编制日期
        this.$set(this.ruleForm, "compileDate", new Date().getTime());
        // 编制人
        this.$set(
          this.ruleForm,
          "compilePeople",
          localStorage.getItem("curentUserName")
        );

        // 验收人
        this.$set(
          this.ruleForm,
          "acceptor",
          localStorage.getItem("curentUserName")
        );
        // 验收人联系电话
        this.$set(
          this.ruleForm,
          "acceptancePhone",
          localStorage.getItem("curentUserPhone")
        );
        // this.ruleForm.businessType = "3";
        this.$store.commit("setContractId", smpPcConc.id);
        this.$store.commit("setContractCode", smpPcConc.contractCode);
      });
    },
    // 日期格式转换
    formatDate(date) {
      // date = new Date();
      date = new Date(date); //转换成Data();
      var y = date.getFullYear();
      var m = date.getMonth() + 1;
      m = m < 10 ? "0" + m : m;
      var d = date.getDate();
      d = d < 10 ? "0" + d : d;
      return y + "-" + m + "-" + d;
    },
    // 清空名称空格
    handleTrim(key) {
      this.$set(
        this.ruleForm,
        key,
        this.ruleForm[key].replace(/(^\s*)|(\s*)$/g, "")
      );
    },
    // 表单验证定位
    positionFrom() {
      return new Promise((resolve, reject) => {
        this.$refs["ruleForm"].validate(valid => {
          if (valid) {
            resolve("成功");
          } else {
            reject({ tabLabel: "基本信息", isFocus: "first" });
            return false;
          }
        });
      });
    },
    // 新增时默认写入
    huixian() {
      this.ruleForm.acceptanceType = this.$route.query.title
      if (this.$route.query.title === "按合同验收") {
        this.contractCheck();
        this.ruleForm.acceptanceTypeCode = '3';
      } else {
        this.orderCheck();
        this.ruleForm.acceptanceTypeCode = '2';
      }
    },
    //合同详情
    contractCheck() {
      this.allLoading = true;
      getSmpPcConcById({
        concId: this.$route.query.data
      }).then(res => {
        const { smpPcConc, pcFinance } = res.data.data;
        // supplierOrgId 供应商主键id
        // 订单验收
        // 合同id 合同编号 合同名称
        // 订单编号  订单id 订单名称

        // 合同
        // 合同id 合同编号 合同名称

        // 发货
        // 发货单号  发货id 发货名称
        // 合同id 合同编号 合同名称
        // 订单编号  订单id 订单名称
        // 分类名称
        this.$set(
          this.ruleForm,
          "categoryName",
          smpPcConc.thirdCategoriesOfName || "后端没反"
        );

        // 发货数量
        this.$set(
          this.ruleForm,
          "deliveryCurrentNumber",
          smpPcConc.shipmentsNum
        );
        // 订单编号
        this.$set(this.ruleForm, "orderNumber", smpPcConc.orderNumber);
        // 填报单位编码
        this.$set(
          this.ruleForm,
          "reportInOrgId",
          JSON.parse(this.$route.query.orgRow).orgId
        );
        // 填报单位
        this.$set(
          this.ruleForm,
          "reportInOrgName",
          JSON.parse(this.$route.query.orgRow).orgName
        );
        // 供应商ID
        this.$set(this.ruleForm, "supplierOrgId", smpPcConc.companyOrgId); // 编码与id一样
        // 供应商编码
        this.$set(this.ruleForm, "supplierCode", smpPcConc.partyBId);
        // 供应商
        this.$set(this.ruleForm, "supplier", smpPcConc.partyBName);

        // 供应商联系电话
        this.$set(this.ruleForm, "supplierPhone", pcFinance.contractPersonTel);
        // 合同名称
        this.$set(
          this.ruleForm,
          "contractName",
          smpPcConc.contractName.toString()
        );

        // 合同ID
        this.$set(this.ruleForm, "contractId", smpPcConc.id);

        // 合同编号
        this.$set(
          this.ruleForm,
          "contractNumber",
          smpPcConc.contractCode.toString()
        );

        // 编制日期
        this.$set(this.ruleForm, "compileDate", new Date().getTime());
        // 编制人
        this.$set(
          this.ruleForm,
          "compilePeople",
          localStorage.getItem("curentUserName")
        );

        // 验收人
        this.$set(
          this.ruleForm,
          "acceptor",
          localStorage.getItem("curentUserName")
        );
        // 验收人联系电话
        this.$set(
          this.ruleForm,
          "acceptancePhone",
          localStorage.getItem("curentUserPhone")
        );
        this.allLoading = false;
        // 验收单编号
        // this.$set(this.ruleForm, "acceptanceNumber", "自动生成");
      });
    },
    //订单详情
    orderCheck() {
      const itemData = this.$route.query.data;
      this.allLoading = true;
      getOrder({ id: itemData }).then(res => {
        const { ocOrderBasic } = res.data.data;
        // supplierOrgId 供应商主键id
        // 订单验收
        // 合同id 合同编号 合同名称
        // 订单编号  订单id 订单名称

        // 合同
        // 合同id 合同编号 合同名称

        // 发货
        // 发货单号  发货id 发货名称
        // 合同id 合同编号 合同名称
        // 订单编号  订单id 订单名称

        // 供应商编码
        this.$set(this.ruleForm, "supplierCode", ocOrderBasic.partyBId);
        // 订单主键
        this.$set(this.ruleForm, "orderId", ocOrderBasic.id);

        // 合同ID
        this.$set(this.ruleForm, "contractId", ocOrderBasic.pcConcId);
        // 分类名称
        this.$set(
          this.ruleForm,
          "categoryName",
          ocOrderBasic.thirdCategoriesOfName
        );
        // 供应商ID
        this.$set(this.ruleForm, "supplierOrgId", ocOrderBasic.companyOrgId); // smpPcConc.companyOrgId
        // 供应商联系电话
        this.$set(
          this.ruleForm,
          "supplierPhone",
          ocOrderBasic.contractPersonTel
        );

        // 供应商联系人
        this.$set(this.ruleForm, "contractPerson", ocOrderBasic.contractPerson);

        // 发货数量
        this.$set(
          this.ruleForm,
          "deliveryCurrentNumber",
          ocOrderBasic.shipmentsNum
        );
        // 订单编号
        this.$set(this.ruleForm, "orderNumber", ocOrderBasic.orderNo);
        // 订单名称
        this.$set(this.ruleForm, "orderName", ocOrderBasic.orderName);

        // 填报单位编码
        this.$set(
          this.ruleForm,
          "reportInOrgId",
          JSON.parse(this.$route.query.orgRow).orgId
        );
        // 填报单位
        this.$set(
          this.ruleForm,
          "reportInOrgName",
          JSON.parse(this.$route.query.orgRow).orgName
        );
        // 供应商
        this.$set(
          this.ruleForm,
          "supplier",
          ocOrderBasic.partyBName.toString()
        );
        // 合同名称
        this.$set(
          this.ruleForm,
          "contractName",
          ocOrderBasic.contractName.toString()
        );

        // 合同编号
        this.$set(
          this.ruleForm,
          "contractNumber",
          ocOrderBasic.contractCode.toString()
        );

        // 编制日期
        this.$set(this.ruleForm, "compileDate", new Date().getTime());
        // 编制人
        this.$set(
          this.ruleForm,
          "compilePeople",
          localStorage.getItem("curentUserName")
        );
        // 验收人
        this.$set(
          this.ruleForm,
          "acceptor",
          localStorage.getItem("curentUserName")
        );
        // 验收人联系电话
        this.$set(
          this.ruleForm,
          "acceptancePhone",
          localStorage.getItem("curentUserPhone")
        );
        this.allLoading = false;
      });
    }
  }
};
</script>

<style lang="scss" scoped>
.demo-ruleForm {
  width: 80%;
  margin: 20px 0 0 50px;
}

.relative {
  position: relative;
  .chereay {
    margin-left: 10px;
    position: absolute;
    top: 0;
    right: -80px;
  }
}
.demo-ruleForm .el-select {
  width: 100%;
}
.overflow {
  display: inline-block;
  width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
</style>
